home *** CD-ROM | disk | FTP | other *** search
/ Apple Developer Connection 1998 Fall: Game Toolkit / Disc.iso / SDKs / Apple Game Sprockets / NetSprocket / NewNSpTest Sources / init.c < prev    next >
Encoding:
C/C++ Source or Header  |  1997-09-18  |  2.6 KB  |  144 lines  |  [TEXT/CWIE]

  1. /***********************************************************************
  2. #
  3. #        init.c
  4. #
  5. #        basic initialization code.
  6. #
  7. #        Author: Michael Marinkovich
  8. #                Apple Developer Technical Support
  9. #
  10. #
  11. #        Modification History: 
  12. #
  13. #            6/4/95        MWM     Initial coding                     
  14. #            10/12/95    MWM        cleaned up
  15. #
  16. #        Copyright © 1992-95 Apple Computer, Inc., All Rights Reserved
  17. #
  18. #
  19. ***********************************************************************/
  20.  
  21.  
  22. #include <AppleEvents.h>
  23. #include <Displays.h>
  24. #include <Events.h>
  25. #include <Fonts.h>
  26. #include <Gestalt.h>
  27. #include <Menus.h>
  28. #include <OSUtils.h>
  29.  
  30. #include "App.h"
  31. #include "Proto.h"
  32. #include "NetStuff.h"
  33.  
  34. extern Boolean             gHasDMTwo;
  35. extern Boolean             gHasDrag;
  36. extern Boolean            gInBackground;
  37. extern short            gWindCount;
  38.  
  39.  
  40. //----------------------------------------------------------------------
  41. //
  42. //    Initialize - the main entry point for the initialization
  43. //
  44. //
  45. //----------------------------------------------------------------------
  46.  
  47. OSErr Initialize(void)
  48. {
  49.     OSErr        err = noErr;
  50.     OSStatus    status;    
  51.     
  52.     ToolBoxInit();
  53.     CheckEnvironment();
  54.     err = InitApp();
  55.     status = InitNetworking('BLAm');
  56.     
  57.     return err;
  58. }
  59.  
  60.  
  61. //----------------------------------------------------------------------
  62. //
  63. //    ToolBoxInit - initialization all the needed managers
  64. //
  65. //
  66. //----------------------------------------------------------------------
  67.  
  68. void ToolBoxInit(void)
  69. {
  70.  
  71.     InitGraf(&qd.thePort);
  72.     InitFonts();
  73.     InitWindows();
  74.     InitMenus();
  75.     TEInit();
  76.     InitDialogs(nil);
  77.     InitCursor();
  78.         
  79.     FlushEvents(everyEvent, 0);
  80.  
  81. }
  82.  
  83.  
  84. //----------------------------------------------------------------------
  85. //
  86. //    CheckEnvironment - make sure we can run with current sys and managers.
  87. //                       Also initialize globals - have drag & drop
  88. //                      
  89. //----------------------------------------------------------------------
  90.  
  91. void CheckEnvironment(void)
  92. {
  93.     OSErr            err;
  94.     long            response;
  95.     
  96.     // your stuff here
  97. }
  98.  
  99.  
  100. //----------------------------------------------------------------------
  101. //
  102. //    InitApp - initialization all the application specific stuff
  103. //
  104. //
  105. //----------------------------------------------------------------------
  106.  
  107. OSErr InitApp(void)
  108. {
  109.     OSErr                err;
  110.  
  111.     // init AppleEvents
  112.     err = AEInit();
  113.     MenuSetup();
  114.  
  115.     // init any globals
  116.     gWindCount = 1;
  117.  
  118.     return err;
  119.     
  120. }
  121.  
  122.  
  123. //----------------------------------------------------------------------
  124. //
  125. //    MenuSetup - 
  126. //
  127. //
  128. //----------------------------------------------------------------------
  129.  
  130. void MenuSetup(void)
  131. {
  132.     Handle            menu;
  133.         
  134.         
  135.     menu = GetNewMBar(rMBarID);        //    get our menus from resource
  136.     SetMenuBar(menu);
  137.     DisposeHandle(menu);
  138.     AppendResMenu(GetMenuHandle(mApple ), 'DRVR');        //    add apple menu items
  139.  
  140.     DrawMenuBar();
  141.  
  142.         
  143. }
  144.